package com.yanzengen.today_newstop.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yanzengen.lazyviewpager.LazyFragmentPagerAdapter;
import com.yanzengen.today_newstop.R;

public class NewFragment extends Fragment implements LazyFragmentPagerAdapter.Laziable{
    private static final String ARG_PARAM_TITLE = "param1";
    private static final String ARG_PARAM2 = "param2";

    private String mParamTitle;
    private String mParam2;

    TextView pagerTitle;

    public NewFragment() {
    }

    public static NewFragment newInstance(String param1, String param2) {
        NewFragment fragment = new NewFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM_TITLE, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParamTitle = getArguments().getString(ARG_PARAM_TITLE);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_new, container, false);
        pagerTitle=(TextView)view.findViewById(R.id.pagertitle);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        if(!TextUtils.isEmpty(mParamTitle)){
            pagerTitle.setText(mParamTitle);
        }
    }
}
